package org.jeecg.modules.equipment.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.log4j.Log4j2;
import org.jeecg.modules.equipment.entity.FilterelementReplace;
import org.jeecg.modules.equipment.mapper.FilterelementReplaceMapper;
import org.jeecg.modules.equipment.service.FilterelementReplaceService;
import org.jeecg.modules.equipment.vo.FilterelementReplaceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: zhuzhuhong
 * @Date: 2019/11/12 14:05
 * @Description:
 */
@Service
@Log4j2
public class FilterelementReplaceServiceImpl
        extends ServiceImpl<FilterelementReplaceMapper, FilterelementReplace>
        implements FilterelementReplaceService {

    @Autowired
    private FilterelementReplaceMapper filterelementReplaceMapper;

    @Override
    public IPage<FilterelementReplaceVO> findFilterelementReplaceVO(Integer pageNo, Integer pageSize,String equipmentId) {
        IPage<FilterelementReplaceVO> page = new Page<>(pageNo, pageSize);
        try {
            List<FilterelementReplaceVO> filterelementReplaceVOS = filterelementReplaceMapper.selectFilterelementReplaceVO(equipmentId);
            if (CollectionUtil.isNotEmpty(filterelementReplaceVOS)) {
                page.setRecords(filterelementReplaceVOS);
            }
        } catch (Exception e) {
            log.error(e.getMessage(),e);
        }
        return page;
    }
}
